package refactor.formtemplatemethod;

import java.util.List;

public class Customer {
    private final TextStatement textStatement = new TextStatement();
    private final HtmlStatement htmlStatement = new HtmlStatement();
    private List<Rental> rentals;
    private String name;

    public Customer(List rentals, String name) {
        this.rentals = rentals;
        this.name = name;
    }

    public String state() {
        //add footer lines
        return textStatement.state(this);
    }

    public String htmlState() {
        //add footer lines
        return htmlStatement.state(this);
    }

    public double calcTotalAmount() {
        double totalAmount = 0;
        for (Rental rental : rentals) {
            totalAmount += rental.getCharge();
        }
        return totalAmount;
    }


    public int calcFrequentRenterPoints() {
        int frequentRenterPoints = 0;
        for (Rental rental : rentals) {
            frequentRenterPoints = rental.getFrequentRenterPoint();
        }
        return frequentRenterPoints;
    }

    public String getName() {
        return name;
    }

    public List<Rental> getRentals() {
        return rentals;
    }
}